/**
 * Copyright (C) 2017 - 2020 https://github.com/joewee
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bifrost.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigInteger;

/**
 *
 *会员卡绑定记录
 *@author joewee
 *@version 1.0.0
 *@Date 2018/4/14 21:00
 */
@Entity
@Table(name = "CUSTOMER_CARD_HISTORY",indexes = {
        @Index(name = "OPENID_CARD_NUMBER_INDEX",columnList = "OPENID,CARD_NUMBER",unique = true),
        @Index(name = "MERCHANT_ID_CARD_NUMBER_INDEX",columnList = "MERCHANT_ID,CARD_NUMBER",unique = true),
        @Index(name = "MERCHANT_ID_TELEPHONE_INDEX",columnList = "MERCHANT_ID,TELEPHONE")
})
public class CustomerCardHistory extends BaseEntity implements Serializable{
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "ID", unique = true, nullable = false)
    private Long id;

    @Column(name = "CARD_NUMBER",length = 32)
    private String cardNumber;

    @Column(name = "MERCHANT_ID")
    private Long merchantId;

    @Column(name = "OPENID",length = 32)
    private String openid;

    @Column(name = "UNION_ID",length = 32)
    private String unionId;

    @Column(name = "TELEPHONE",length = 16)
    private String telephone;

    @Column(name = "BONUS_PONITS")
    private BigInteger bonusPonits =BigInteger.ZERO ;

    public CustomerCardHistory() {
    }

    public CustomerCardHistory(String cardNumber, String openid,  Long merchantId,String unionId, BigInteger bonusPonits) {
        this.cardNumber = cardNumber;
        this.merchantId = merchantId;
        this.openid = openid;
        this.unionId = unionId;
        this.bonusPonits = bonusPonits;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCardNumber() {
        return cardNumber;
    }

    public void setCardNumber(String cardNumber) {
        this.cardNumber = cardNumber;
    }

    public Long getMerchantId() {
        return merchantId;
    }

    public void setMerchantId(Long merchantId) {
        this.merchantId = merchantId;
    }

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public String getUnionId() {
        return unionId;
    }

    public void setUnionId(String unionId) {
        this.unionId = unionId;
    }

    public BigInteger getBonusPonits() {
        return bonusPonits;
    }

    public void setBonusPonits(BigInteger bonusPonits) {
        this.bonusPonits = bonusPonits;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }
}
